#!/usr/bin/env python3
# _*_coding:utf-8_*_
# cockroach
# email:donnie.fan@foxmail.com

import time
def timer(func):
    def wrapper(*args,**kwargs):
        start_time=time.time()
        print("start time is %s " % start_time)
        res = func(*args,**kwargs)
        stop_time = time.time()
        print("stop time is %s" % stop_time)
        print("run is time %s" % (stop_time-start_time))
        return res
    return wrapper

def auth(func):
    def wrapper(*args,**kwargs):
        while True:
            user=input("input user name:>>").strip()
            passwd = input("input user passwd:>>").strip()
            if len(user) == 0:continue
            if len(passwd) == 0:continue
            if user == "fht" and passwd == "123":
                func(*args,**kwargs)
                exit()
            else:
                continue
    return wrapper


@auth
def index(msg):
    print("in the func %s" % msg)
    return 1

@timer
def home(user,msg):
    print("in the home %s %s" % (user,msg))

# res = index("aaaa")
# home("tom",msg="xxxxx")
# print(res)

index("hello world")

